﻿namespace CSharpPro;

public class Demo
{

    public void TestPint()
    {
        Console.WriteLine("\n请输入一个年份：");
        if (int.TryParse(Console.ReadLine(), out int inputYear))
        {
            bool result = IsLeapYear(inputYear);
            Console.WriteLine($"{inputYear}年{(result ? "是" : "不是")}闰年");
        }
        else
        {
            Console.WriteLine("输入的不是有效的年份！");
        }
       
        Console.WriteLine("\n按任意键退出...");
        Console.ReadKey();
    } 
    static bool IsLeapYear(int year)
    {
        return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
    }
        /*int sum = 123;
        Console.WriteLine(sum /100);
        Console.WriteLine(sum%100/10);
        Console.WriteLine(sum/10%10);
        Console.WriteLine(sum%10);
        Console.WriteLine(5.0%2.2);*/
    }
